import React, { Component } from 'react';
import "../../styles/search/HotSearch.css"
import { GetHotSearch } from '../../api/search';

class HotSearch extends Component {
    constructor(props) {
        super(props)
        this.state = {
            HotSearchList: []
        }
    }

    componentDidMount() {
        GetHotSearch().then((res) => {
            console.log(res.data.list);
            this.setState({
                HotSearchList: res.data.list
            })
        })

    }

    render() {
        return (
            <div className='HotSearch'>
                <div className='title'>热门搜索</div>
                <div className='main'>
                    {
                        this.state.HotSearchList.map((item, index) => {
                            return (
                                <div key={index} >{item}</div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default HotSearch;